package com.example.demo.merchant.controller;

import com.example.demo.merchant.params.MerchantRequestParams;
import com.example.demo.merchant.service.MerchantService;
import com.example.demo.utils.R;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;

@RestController
@RequestMapping("merchant")
public class MerchantController {

    @Resource
    private MerchantService merchantService;

    @PostMapping("add")
    public R add(@RequestBody MerchantRequestParams merchantRequestParams) {
        System.out.println(">>>>>>>" + merchantRequestParams.getMname());
        return merchantService.add(merchantRequestParams) == 1 ? R.ok("注册成功") : R.fail("注册失败，重新注册");
    }
}